package net.gazhi.delonix.core.jpa;

import org.hibernate.Criteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * 业务逻辑层 Service 基类
 * 
 * @author Jeffrey Lin
 *
 */
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public abstract class AbstractJpaService {

	@Autowired
	protected Dao dao;

	protected Criteria createCriteria(Class<?> entityClass) {
		return dao.createCriteria(entityClass);
	}

	protected Criteria createCriteria(Class<?> entityClass, String alias) {
		return dao.createCriteria(entityClass, alias);
	}

}
